package com.liyiqing.secondhandmall.productservice.service.impl;

import com.liyiqing.commonservice.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.liyiqing.commonservice.utils.PageUtils;
import com.liyiqing.commonservice.utils.Query;

import com.liyiqing.secondhandmall.productservice.dao.ProductCategoryDao;
import com.liyiqing.secondhandmall.productservice.entity.ProductCategoryEntity;
import com.liyiqing.secondhandmall.productservice.service.ProductCategoryService;

import javax.annotation.Resource;


@Service("productCategoryService")
public class ProductCategoryServiceImpl extends ServiceImpl<ProductCategoryDao, ProductCategoryEntity> implements ProductCategoryService {

    @Resource
    private ProductCategoryDao productCategoryDao;


    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        IPage<ProductCategoryEntity> page = this.page(
                new Query<ProductCategoryEntity>().getPage(params),
                new QueryWrapper<ProductCategoryEntity>()
        );

        return new PageUtils(page);
    }



    @Override
    public R selectAllProductCategory() {
//        List<ProductCategoryEntity> list = productCategoryDao.selectAllProductCategory();
        List<ProductCategoryEntity> list = productCategoryDao.selectList(null);
        return R.ok().put("data", list);
    }
}